@include("system::admin.layouts._header")
<body>
<style>
    .ds_type {
        display: none;
    }
</style>
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form" method="post">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">

            <ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
                <li>数据源</li>
            </ul>

            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" class="layui-input" placeholder="请输入名称"
                                   value="{{$data->name}}">
                            <tip>填写名称。</tip>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" class="layui-input" placeholder="请输入标题" value="{{$data->title}}">
                            <tip>填写标题。</tip>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea name="description" id="description" class="layui-textarea"
                                      placeholder="请输入备注">{{$data->description}}</textarea>
                            <tip>填写备注。</tip>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">内容</label>
                        <div class="layui-input-block">
                            <textarea name="content" id="content" class="editor"
                                      placeholder="请输入内容">{{$data->content}}</textarea>
                            <tip>填写内容。</tip>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="ds_type" lay-filter="ds_type" lay-skin="primary" @if($data->ds_type == 'json') checked @endif
                                   value="json" title="JSON数据">
                            <input type="radio" name="ds_type" lay-filter="ds_type" lay-skin="primary" @if($data->ds_type == 'db') checked @endif value="db"
                                   title="连接数据库">
                        </div>
                    </div>
                    <div class="layui-form-item ds_type" @if($data->ds_type == 'json') style="display: block" @endif id="json_type">
                        <label class="layui-form-label">JSON数据</label>
                        <div class="layui-input-block">
                            <textarea name="json_data" id="json_data" class="layui-textarea"
                                      placeholder="请输入JSON数据">{{$data->json_data}}</textarea>
                            <tip>填写JSON数据。</tip>
                        </div>
                    </div>

                    <div class="ds_type" id="db_type" @if($data->ds_type == 'db') style="display: block" @endif>

                        <div class="layui-form-item">
                            <label class="layui-form-label">数据表</label>
                            <div class="layui-input-block">
                                <input type="text" name="db_table" class="layui-input" placeholder="请输入数据表"
                                       value="{{$data->db_table}}">
                                <tip>填写数据表。</tip>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">过滤条件</label>
                            <div class="layui-input-block">
                                <textarea name="db_condition" class="layui-textarea"
                                          placeholder="请输入过滤条件">{{$data->db_condition}}</textarea>
                                <tip>填写过滤条件。</tip>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">单次数量</label>
                            <div class="layui-input-block">
                                <input type="text" name="db_limit" class="layui-input" placeholder="请输入单次数量" value="{{$data->db_limit}}">
                                <tip>填写单次数量，0为不限制。</tip>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">后置操作</label>
                            <div class="layui-input-block">
                                <textarea name="db_action" class="layui-textarea"
                                          placeholder="请输入后置操作">{{$data->db_action}}</textarea>
                                <tip>填写后置操作。</tip>
                            </div>
                        </div>
                    </div>

                </div>
            </div>


            <div class="hr-line"></div>
            <div class="layui-form-item text-center">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
            </div>
        </div>

    </form>
</div>
</body>
</html>
